package com.itbour.def;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 *
 * copyright   pirate alliance team 2014
 * @author     xuwei
 *
 */
public class SysApplicationContext implements ApplicationContextAware
{
    private static ApplicationContext context = null;

    /* (non-Javadoc)
     * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
     */
    public void setApplicationContext(ApplicationContext context)
            throws BeansException
    {
    	SysApplicationContext.context = context;

    }

    /**
     * Spring对象取得
     * @param beanNm
     * @return
     */
    public static Object getBean(String beanNm)
    {
        return context.getBean(beanNm);
    }
}
